//
//  BlackListTableViewCell.m
//  Router
//
//  Created by teki on 15/11/11.
//  Copyright © 2015年 dc. All rights reserved.
//

#import "BlackListTableViewCell.h"

@interface BlackListTableViewCell ()
@property (weak, nonatomic) IBOutlet UILabel *userNameLabel;
@property (weak, nonatomic) IBOutlet UIButton *blackList;
@property (nonatomic, copy) MoveFromBlackListBlock block;
@end

@implementation BlackListTableViewCell

- (void)awakeFromNib {
    // Initialization code
    self.userNameLabel.textColor = SeparatorLineColor;

    self.blackList.layer.cornerRadius = 5.0f;
    self.blackList.layer.masksToBounds = YES;
    [self.blackList setTitleColor:[UIColor colorWithHexString:@"#e1f5de"] forState:UIControlStateNormal];
    [self.blackList setBackgroundImage:[UIImage imageWithColor:[UIColor colorWithHexString:@"#5ca954"]] forState:UIControlStateNormal];
    [self.blackList setTitleColor:SeparatorLineColor forState:UIControlStateSelected];
    [self.blackList setBackgroundImage:[UIImage imageWithColor:[UIColor colorWithHexString:@"#e1f6de"]] forState:UIControlStateSelected];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}




- (void)setModel:(DeviceInfoModel *)model
{
    _model = model;
    self.userNameLabel.text = model.hostname;
}

- (void)setMoveFromBlackListBlock:(MoveFromBlackListBlock)block
{
    _block = block;
}

- (IBAction)moveFromBlackListButtonPressed:(id)sender {
    if (self.block)
    {
        self.block(self.model);
    }
}

@end
